home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Juegos Flash / desertZone.dcr / Internal_27_dustemitter.ls < prev    next >
Encoding:
Text File  |  2003-08-01  |  1.5 KB  |  50 lines

  1. property pTrackmanager, pStrength, pCar, pStep, pSmallInitData, pBigInitData, pBigDust, pDustPuffManager
  2. global gEffects
  3.  
  4. on new me, tTrackManager, tCar
  5.   pCar = tCar
  6.   pTrackmanager = tTrackManager
  7.   pTrackmanager.INeedAnUpdateEachFrame(me)
  8.   pDustPuffManager = pTrackmanager.getDustPuffManager()
  9.   me.setStrength(0)
  10.   pStep = 0
  11.   pSmallInitData = [#direction: point(0, 0), #startsize: 20, #endsize: 60, #duration: 5, #animProgression: 0]
  12.   pBigInitData = [#direction: point(3, 3), #startsize: 30, #endsize: 170, #duration: 10, #animProgression: 0]
  13.   pBigDust = 0
  14.   return me
  15. end
  16.  
  17. on setStrength me, tStrength
  18.   pStrength = tStrength
  19. end
  20.  
  21. on setBigDust me, tBig
  22.   pBigDust = tBig
  23. end
  24.  
  25. on Update me
  26.   if gEffects[#dust] then
  27.     pStep = pStep + 1
  28.     if pStrength > 0 then
  29.       if pCar.onScreen() then
  30.         if (pStep mod (100 / pStrength)) <= 1 then
  31.           tCarPos = pCar.getPosition()
  32.           pSmallInitData[#direction] = point(random(-3, 3), random(-3, 3))
  33.           pSmallInitData[#position] = tCarPos + (pCar.pCurrentWheelPositions[2] * 0.90000000000000002)
  34.           pDustPuffManager.newDustPuff(pSmallInitData.duplicate())
  35.           pSmallInitData[#position] = tCarPos + (pCar.pCurrentWheelPositions[4] * 0.90000000000000002)
  36.           pDustPuffManager.newDustPuff(pSmallInitData.duplicate())
  37.         end if
  38.       end if
  39.     end if
  40.   end if
  41. end
  42.  
  43. on cleanUp me
  44.   pTrackmanager.IDontNeedAPhysicsUpdateEachFrame(me)
  45.   pTrackmanager = 0
  46.   pCar = 0
  47.   pDustPuffManager = 0
  48.   return 0
  49. end
  50.